<%@ page language="java" contentType="text/html; charset=UTF-8" isErrorPage="true" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="pagePath" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="${pagePath}/page/static/css/reset.css">
<link rel="stylesheet" type="text/css" href="${pagePath}/page/static/css/main.css">
<title>校园二手交易网-个人中心</title>
</head>
<body>
	<div class="header_con">
		<div class="header">
			<div class="welcome fl">欢迎来到 校园二手交易网！</div>
			<div class="fr">
				<div class="user_link fl">
					<c:if test="${!empty loguser}">
						欢迎您：<em style="color: red;">${loguser.username}</em>
						<span>|</span>
						<a href="${pagePath}/logout.do">退出</a>
					</c:if>
				</div>
				<div class="login_btn fl">
					<c:if test="${empty loguser}">
						<a href="${pagePath}/login.do">登录</a>
						<span>|</span>
						<a href="${pagePath}/register.do">注册</a>
					</c:if>
				</div>
			</div>
		</div>
	</div>
	<div class="search_bar clearfix">
		<a href="${pagePath}/index.do" class="logo fl"><img src="${pagePath}/page/static/images/logo.png"></a>
		<div class="sub_page_name fl">&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;个人中心</div>
		<div class="search_con fr">
			<form action="${pagePath}/goods.do">
				<input type="text" class="input_text fl" id="key" name="key" placeholder="搜索商品" required="required"> <input type="submit" class="input_btn fr" value="搜索">
			</form>
		</div>
	</div>
	<div class="navbar_con">
		<div class="navbar">
			<h1 class="fl">个人中心</h1>
			<ul class="navlist fl">
				<li><a href="${pagePath}/index.do" class="active">商品区</a></li>
				<li class="interval">|</li>
				<li><a href="${pagePath}/index_task.do">任务区</a></li>
				<li class="interval">|</li>
				<li><a href="${pagePath}/personal_info.do">个人中心</a></li>
				<li class="interval">|</li>
				<li><a href="${pagePath}/cart.do">购物车</a></li>
			</ul>
		</div>
	</div>
	<div class="main_con clearfix">
		<div class="left_menu_con clearfix">
			<ul style="padding-top: 30px;">
				<li><a href="${pagePath}/personal_info.do">· 个人信息</a></li>
				<li><a href="${pagePath}/personal_order.do" class="active">· 全部订单</a></li>
				<li><a href="${pagePath}/personal_address.do">· 收货地址</a></li>
			</ul>
		</div>
		<div class="right_content clearfix">
			<h3 class="common_title2">订单列表</h3>
			<span style="color: red;">${message}</span>
			<c:forEach items="${orderDetailsItems}" var="orderDetailsItem">
				<ul class="order_list_th w978 clearfix">
					<li class="col01"><fmt:formatDate value="${orderDetailsItem.order.createTime}" pattern="yyyy-MM-dd HH:mm:ss" /></li>
					<li class="col02">订单号：${orderDetailsItem.order.id}</li>
					<li class="col02 stress">${orderDetailsItem.order.status}</li>
					<li class="col02"><c:if test="${orderDetailsItem.order.type eq '1'}">商品订单</c:if> <c:if test="${orderDetailsItem.order.type eq '2'}">任务订单</c:if></li>
				</ul>
				<table class="order_list_table w980">
					<tbody>
						<tr>
							<td width="55%"><c:forEach items="${orderDetailsItem.orderDetails}" var="orderDetails">
									<ul class="order_goods_list clearfix">
										<li class="col01"><img src="${pagePath}${orderDetails.picture}"></li>
										<li class="col02">${orderDetails.name}</li>
										<li class="col04">${orderDetails.price}元</li>
									</ul>
								</c:forEach></td>
							<td width="15%">${orderDetailsItem.order.price}元</td>
							<td width="15%">
								<c:if test="${orderDetailsItem.order.status eq '待收货'}">
									<a href="${pagePath}/order_confirm.do?order_id=${orderDetailsItem.order.id}&type=${orderDetailsItem.order.type}" style="color: red;">确认收货</a>
								</c:if>
								<c:if test="${orderDetailsItem.order.status eq '待完成'}">
									<a href="${pagePath}/order_confirm.do?order_id=${orderDetailsItem.order.id}&type=${orderDetailsItem.order.type}" style="color: red;">完成确认</a>
								</c:if>
								<c:if test="${orderDetailsItem.order.status eq '已评价'}">
									已评价
								</c:if>
								<c:if test="${orderDetailsItem.order.status ne '待收货' && orderDetailsItem.order.status ne '待完成' && orderDetailsItem.order.status ne '已评价'}">${orderDetailsItem.order.status}
									| <a href="${pagePath}/personal_appraise.do?orderId=${orderDetailsItem.order.id}">评价</a>
								</c:if>
							</td>
						</tr>
					</tbody>
				</table>
			</c:forEach>
			<c:if test="${empty orderDetailsItems}">无订单记录！</c:if>
		</div>
	</div>
	<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>